/**
*      author: Y_Yao
*      created: 2025-04-27 20:12:35
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 9e18;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 7;
unordered_set<int> s[N];
int n,m,q;
bool cnt[N];

void solve()
{
    cin >> n >> m >> q;
    while(q--)
    {
        int op;
        cin >> op;
        if(op == 1)
        {
            int x,y;
            cin >> x >> y;
            s[x].insert(y);
        }
        else if(op == 2)
        {
            int x;
            cin >> x;
            cnt[x] = true; 
        }
        else if(op == 3)
        {
            int x,y;
            cin >> x >> y;
            if(cnt[x] == true)
            {
                cout << "Yes" << endl;
                continue;
            }

            if(s[x].count(y))
            {
                cout << "Yes" << endl;
                continue;
            }

            cout << "No" << endl;
        }
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    // cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}